﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PHPDecoder;

namespace CodeVisual
{
    public partial class ViewNodeDialog : Form
    {
        public ViewNodeDialog()
        {
            InitializeComponent();
        }
        public ViewNodeDialog(String filename)
        {
            this.AutoSize = true;
            Label t = new Label();
            t.AutoSize = true;
            List<DataNode> data = ProjectInfo.result.decodedFile[filename];
            t.Text = "Classes:\r\n";
            foreach (DataNode node in data)
            {
                if (node.tp == NodeType.CLASS && node.isoutput)
                {
                    t.Text += ((ClassNode)node).name + "\r\n";
                }
            }

            t.Text += "\r\n";
            t.Text += "Functions:\r\n";

            foreach (DataNode node in data)
            {
                if (node.tp == NodeType.METHOD && node.isoutput)
                {
                    t.Text += ((FunctionNode)node).name + "\r\n";
                }
            }

            t.Text += "\r\n";
            t.Text += "Variables:\r\n";

            foreach (DataNode node in data)
            {
                if (node.tp == NodeType.VAR && node.isoutput)
                {
                    t.Text += ((VariableNode)node).name + "\r\n";
                }
            }
            t.Parent = this;
        }
    }
}
